/**
 * Created by Administrator on 2017/4/13.
 */
import Vue from 'vue'
import * as publicMethod from './util'
import {imgBaseUrl} from 'config/env.js'

// 来自知乎图片路径过滤
Vue.filter('attachImageUrl',function (val) {
  return publicMethod.attachImageUrl(val)
})
//手机号转义 13400001234 => 134****1234
Vue.filter('secrecyPhone', function (value) {
  if (value && value.length == 11) {
    return `${value.substr(0, 3)}****${value.substr(7)}`
  }
  return value
})

//饿了么图片路径过滤
Vue.filter('getImgPath', function (value) {
  let suffix
  if(!value){
    return 'http://test.fe.ptdev.cn/elm/elmlogo.jpeg'
  }
  if(value.indexOf('jpeg') !== -1){
    suffix = '.jpeg'
  }else {
    suffix = '.png'
  }
  let url = '/' + value.substr(0, 1) + '/' + value.substr(1, 2) + '/' + value.substr(3) + suffix;
  return imgBaseUrl + url
})








